commonlibsse_ng\re\b/
BSIRagdollDriver.rs

1use crate::re::bhkWorld::bhkWorld;
2use crate::re::hkpMotion::MotionType as hkpMotionType;
3use crate::re::offsets_rtti::RTTI_BSIRagdollDriver;
4use crate::re::offsets_vtable::VTABLE_BSIRagdollDriver;
5use crate::rel::id::VariantID;
6
7/// Represents an interface for a ragdoll driver in the Skyrim engine.
8///
9/// This is an abstract base class with pure virtual functions for managing ragdoll physics.
10///
11/// # Memory Layout:
12/// - Pure virtual class, size is 0x8 (vtable pointer only)
13#[repr(C)]
14#[derive(Debug)]
15pub struct BSIRagdollDriver {
16    // No fields; this is an abstract class with only a vtable in C++
17    _vtable: *const BSIRagdollDriverVtbl, // Placeholder for vtable pointer; not directly accessible in Rust
18}
19
20// Compile-time memory layout verification
21const _: () = {
22    assert!(core::mem::size_of::<BSIRagdollDriver>() == 0x8); // Matches sizeof(void*) on 64-bit
23};
24
25impl BSIRagdollDriver {
26    /// RTTI identifier for this type.
27    pub const RTTI: VariantID = RTTI_BSIRagdollDriver;
28
29    /// Virtual function table addresses.
30    pub const VTABLE: [VariantID; 1] = VTABLE_BSIRagdollDriver;
31}
32
33/// Virtual function table for `BSIRagdollDriver`.
34#[repr(C)]
35pub struct BSIRagdollDriverVtbl {
36    /// Destructor function pointer.
37    pub CxxDrop: fn(this: &mut BSIRagdollDriver),
38
39    /// Checks if a ragdoll exists.
40    pub HasRagdoll: fn(this: &BSIRagdollDriver) -> bool,
41
42    /// Adds the ragdoll to the world.
43    pub AddRagdollToWorld: fn(this: &mut BSIRagdollDriver) -> bool,
44
45    /// Removes the ragdoll from the world.
46    pub RemoveRagdollFromWorld: fn(this: &mut BSIRagdollDriver) -> bool,
47
48    /// Sets the world for the ragdoll driver.
49    pub SetWorld: fn(this: &mut BSIRagdollDriver, world: Option<&mut bhkWorld>),
50
51    /// Resets the ragdoll state.
52    pub ResetRagdoll: fn(this: &mut BSIRagdollDriver),
53
54    /// Unknown function (placeholder).
55    pub Unk_06: fn(this: &mut BSIRagdollDriver),
56
57    /// Sets ragdoll constraints from bhk constraints.
58    pub SetRagdollConstraintsFromBhkConstraints: fn(this: &mut BSIRagdollDriver),
59
60    /// Sets the motion type for the ragdoll.
61    pub SetMotionType: fn(this: &mut BSIRagdollDriver, motionType: hkpMotionType),
62
63    /// Unknown function (placeholder).
64    pub Unk_09: fn(this: &mut BSIRagdollDriver),
65
66    /// Toggles synchronization on update.
67    pub ToggleSyncOnUpdate: fn(this: &mut BSIRagdollDriver, disable: bool),
68
69    /// Unknown function (placeholder).
70    pub Unk_0B: fn(this: &mut BSIRagdollDriver),
71
72    /// Toggles constraints on or off.
73    pub ToggleConstraints: fn(this: &mut BSIRagdollDriver, disable: bool),
74
75    /// Unknown function (placeholder).
76    pub Unk_0D: fn(this: &mut BSIRagdollDriver),
77}